package edu.tongji.structureplayer.core.math
{
    public class Matrix extends Determinant
    {
        public function Matrix(dimension:uint)
        {
            super(dimension, dimension);
        }
        
        public function spiltEqualy(dividend:uint):Array
        {
            return spilt(dividend, dividend);
        }
        
        public function setToZero(lineNum:uint):void
        {
            if (lineNum>=dimension)
                return;
            for (var i:uint=0; i<dimension; i++)
            {
                _data[lineNum][i] = 0;
                _data[i][lineNum] = 0;
            }
        }
        
        public function get dimension():uint
        {
            return this.rowDimension;
        }
        
        public static function buildFromDeterminant(det:Determinant):Matrix
        {
            if (det == null)
                return null;
            if (det.data.length != det.data[0].length)
                throw new Error("Not a Matrix!");
            var matrix:Matrix = new Matrix(det.data.length);
            for (var i:uint=0; i<matrix.dimension; i++)
            {
                for (var j:uint=0; j<matrix.dimension; j++)
                {
                    matrix.data[i][j] = det.data[i][j];
                }
            }
            return matrix;
        }
        /*
        public override function transpose():Matrix
        {
            return buildFromDeterminant(super.transpose());
        }
        
        private function buildFromDeterminant(det:Determinant):Matrix
        {
        }*/
    }
}